package de.au.fi.calc.criteria.complex;

import de.au.fi.calc.criteria.Criteria;

public class CriteriaKurs extends Criteria {
	
	Double kursNow;
	Double kurs2compare;

	public CriteriaKurs(String label, Double kursNow, Double kurs2compare) {
		super(label);
		this.kursNow = kursNow;
		this.kurs2compare = kurs2compare;
		this.positiveLimit = 5.0;
		this.negativLimit = -5.0;
	}
	
	@Override
	public int calculate() 
	{
		if(kursNow == null || kurs2compare == null)return 0;
		if(kursNow == 0.0 || kurs2compare == 0.0)return 0;
		Double div = kurs2compare / kursNow;
		div = 1 / div;
		this.value = (div - 1) * 100.0;
		return super.calculate();
	}

}
